-
Notifications
You must be signed in to change notification settings - Fork 184
🌿 Fern Regeneration -- January 27, 2026 #771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| json_encoders = {dt.datetime: serialize_datetime} | ||
|
|
||
| @pydantic.root_validator(pre=True) | ||
| def _coerce_field_names_to_aliases(cls, values: Any) -> Any: |
Check notice
Code scanning / CodeQL
First parameter of a method is not named 'self' Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 1 day ago
In general, to fix this issue you either (a) make the method a proper classmethod and keep cls as the first parameter, or (b) leave it as an instance method and rename the first parameter to self (and adjust its internal usage accordingly). Since this validator logically operates on the class (cls) and not on an instance, the best fix without changing functionality is to convert it to a classmethod.
Concretely, in src/auth0/management/core/pydantic_utilities.py, within the else: branch of class UniversalBaseModel(pydantic.BaseModel):, we should add the @classmethod decorator immediately above the existing @pydantic.root_validator(pre=True) decorator. The method signature can remain def _coerce_field_names_to_aliases(cls, values: Any) -> Any: because once @classmethod is applied, cls is the correct conventional name. The body of the method does not need any changes, since it already refers to cls correctly and uses values as the second argument.
No new imports or additional definitions are required; classmethod is built in and already available.
-
Copy modified line R141
| @@ -138,6 +138,7 @@ | ||
| smart_union = True | ||
| json_encoders = {dt.datetime: serialize_datetime} | ||
|
|
||
| @classmethod | ||
| @pydantic.root_validator(pre=True) | ||
| def _coerce_field_names_to_aliases(cls, values: Any) -> Any: | ||
| """ |
| """Gets the dynamically assigned port for the WireMock container.""" | ||
| compose_file = _compose_file() | ||
| project = _project_name() | ||
| try: |
Check notice
Code scanning / CodeQL
Unused global variable Note test
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 1 day ago
In general, to fix an unused global variable you either (1) remove it if it truly adds no behavior, (2) rename it to an “unused” style name if it is intentionally unused, or (3) actually use it in logic if it was meant to be used. Here, _STARTED is only meaningful inside _start_wiremock and is not exposed outside the module; we can avoid the global state entirely and instead infer whether WireMock has already been started from an observable side effect we already rely on: the WIREMOCK_PORT environment variable.
Best fix without changing external functionality:
- Remove the module-level
_STARTEDdeclaration. - Stop using
_STARTEDas a guard in_start_wiremock. - Use
os.environ.get("WIREMOCK_PORT")as the “started” flag: if it is set, we consider WireMock already started and return immediately. This maintains the “start once per process” behavior while removing the unused global. - Because the code already sets
os.environ["WIREMOCK_PORT"]after starting WireMock, no additional imports are needed.
Concretely in tests/conftest.py:
- Delete line 17 (
_STARTED: bool = False). - In
_start_wiremock, remove_STARTEDfrom theglobalstatement. - Replace the
if _STARTED:guard with an environment-based guard. - Remove the assignment
_STARTED = Trueafter a successful start.
No other files need to be touched.
-
Copy modified lines R60-R62
| @@ -14,7 +14,6 @@ | ||
|
|
||
| import pytest | ||
|
|
||
| _STARTED: bool = False | ||
| _WIREMOCK_PORT: str = "8080" # Default, will be updated after container starts | ||
|
|
||
|
|
||
| @@ -58,8 +57,9 @@ | ||
|
|
||
| def _start_wiremock() -> None: | ||
| """Starts the WireMock container using docker-compose.""" | ||
| global _STARTED, _WIREMOCK_PORT | ||
| if _STARTED: | ||
| global _WIREMOCK_PORT | ||
| # If the environment variable is already set, assume WireMock has been started. | ||
| if os.environ.get("WIREMOCK_PORT"): | ||
| return | ||
|
|
||
| compose_file = _compose_file() | ||
| @@ -75,7 +75,6 @@ | ||
| _WIREMOCK_PORT = _get_wiremock_port() | ||
| os.environ["WIREMOCK_PORT"] = _WIREMOCK_PORT | ||
| print(f"WireMock container is ready on port {_WIREMOCK_PORT}") | ||
| _STARTED = True | ||
| except subprocess.CalledProcessError as e: | ||
| print(f"Failed to start WireMock: {e.stderr}") | ||
| raise |
| headers=test_headers, | ||
| token="test_token", | ||
| ) | ||
| except (TypeError, ValueError): |
Check notice
Code scanning / CodeQL
Empty except Note test
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 1 day ago
In general, an empty except should either be removed (letting the exception propagate), narrowed to only the expected error type, or augmented to log and/or document why the exception is being ignored. For feature-detection patterns like this (trying one API shape and falling back to another), the best fix is to keep the fallback behavior but add a clear comment and minimal logging of the exception so it’s not entirely silent.
For this specific code in tests/wire/conftest.py, we should:
- Keep the
try/exceptand the fallback construction usinghttpx.Client, so existing test behavior is unchanged. - Add a short explanatory comment in the
exceptblock stating that this is a compatibility fallback for differentAuth0constructor signatures. - Optionally (and still lightweight), log the exception to
pytest’s internal logging or to standard output, but since we should avoid changing imports too much and keep tests quiet, a simple comment is enough to satisfy both CodeQL and clarity; however, to meaningfully “handle” the exception, the minimal change is to add a comment plus an explicit no-op statement like# ...plusreturnor just leave the fallback; in Python, a comment alone doesn’t count as code, but CodeQL’s rule is mainly about explanation. To be safe we can add a comment explaining the swallow, leavingpassas the explicit no-op.
The smallest change within the shown snippet is to replace the bare pass with a comment explaining the intentional ignore plus pass. No imports or new methods are required.
-
Copy modified line R49
| @@ -46,6 +46,7 @@ | ||
| token="test_token", | ||
| ) | ||
| except (TypeError, ValueError): | ||
| # Fallback for environments where Auth0 signature or constructor does not accept 'headers'. | ||
| pass | ||
|
|
||
| import httpx |
This PR regenerates code to match the latest API Definition.